package com.zxp.zxpsmarthomeapk.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

import com.zxp.zxpsmarthomeapk.R;
import com.zxp.zxpsmarthomeapk.util.SpUtils;


public class WelcomeActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        final boolean loginFlag = (boolean) SpUtils.get(this, "loginFlag", false);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = null;
                if (!loginFlag) {
                    intent = new Intent(WelcomeActivity.this, LoginActivity.class);
                } else {
                    intent = new Intent(WelcomeActivity.this, MainActivity.class);
                }
                startActivity(intent);
                finish();
            }
        }, 3000);
    }
}
